<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2025/7/16 星期三
  Time: 16:11
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>


<!DOCTYPE html>
<html>

<head>
  <base href="${pageContext.request.contextPath}/" />
  <title>襄阳蓝芯智能化办公系统</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link href="static/bootstrap-3.3.5/css/bootstrap.css" rel="stylesheet">
  <style type="text/css">
    a {
      text-decoration: none;
    }
    a:link{
      text-decoration: none;
    }
  </style>
  <script src="static/jquery/jquery-1.10.2.min.js"></script>
  <script src="static/bootstrap-3.3.5/js/bootstrap.js"></script>
</head>
<body>
<div class="container-fluid">
  <div class="row">
    <%-- 公司新闻部分 --%>
    <div class="col-md-6">
      <div class="panel panel-primary">
        <div class="panel-heading">
          <h3 class="panel-title">公司新闻</h3>
        </div>
        <table class="table table-hover table-condensed">
          <tbody>
          <%-- 遍历公司新闻列表（最多5条） --%>
          <c:forEach items="${newsList}" var="news" varStatus="status">
            <tr>
              <td>&nbsp;<a href="xx/information/informationInfo?oid=${news.oid}">${news.title}</a></td>
            </tr>
          </c:forEach>

          <%-- 不足5条时补充空白行 --%>
          <c:forEach begin="${fn:length(newsList)}" end="4">
            <tr>
              <td>&nbsp;</td>
            </tr>
          </c:forEach>

          <tr>
            <td align="right"><a href="xx/information/listInformation?typeid=1">更多</a></td> <%-- 筛选公司新闻 --%>
          </tr>
          </tbody>
        </table>
      </div>
    </div>

    <div class="col-md-6">
      <div class="panel panel-primary">
        <div class="panel-heading">
          <h3 class="panel-title">待审批工作</h3>
        </div>
        <table class="table table-hover table-condensed">
          <tbody>
          <%--只显示5行数据--%>
          <c:forEach items="${myApprovals}" var="approval" end="4">
            <tr>
              <td>
                <a href="judge/approval/toApproval?oid=${approval.oid}">
                  <c:choose>
                    <c:when test="${approval.docType eq 'BXD'}">报销申请</c:when>
                    <c:when test="${approval.docType eq 'GMD'}">资产购买申请</c:when>
                    <c:when test="${approval.docType eq 'YDD'}">资产移动申请</c:when>
                  </c:choose>
                </a>
              </td>
            </tr>
          </c:forEach>

          <%--不足五行的自动补充空白行，保证页面美观--%>
          <c:forEach begin="${fn:length(myApprovals)}" end="4">
            <tr>
              <td>
                &nbsp;
              </td>
            </tr>
          </c:forEach>

          <%--固定底行为显示更多--%>
          <tr>
            <td align="right"><a href="judge/approval/listMyApproval">更多</a></td>
          </tr>
          </tbody>
        </table>
      </div>
    </div>
  </div>

  <div class="row">
    <%-- 通知公告部分 --%>
    <div class="col-md-6">
      <div class="panel panel-primary">
        <div class="panel-heading">
          <h3 class="panel-title">通知公告</h3>
        </div>
        <table class="table table-hover table-condensed">
          <tbody>
          <%-- 遍历通知公告列表（最多5条） --%>
          <c:forEach items="${noticeList}" var="notice" varStatus="status">
            <tr>
              <td>&nbsp;<a href="xx/information/informationInfo?oid=${notice.oid}">${notice.title}</a></td>
            </tr>
          </c:forEach>

          <%-- 不足5条时补充空白行 --%>
          <c:forEach begin="${fn:length(noticeList)}" end="4">
            <tr>
              <td>&nbsp;</td>
            </tr>
          </c:forEach>

          <tr>
            <td align="right"><a href="xx/information/listInformation?typeid=2">更多</a></td> <%-- 筛选通知公告 --%>
          </tr>
          </tbody>
        </table>
      </div>
    </div>
      <%-- 内部短消息部分 --%>
      <div class="col-md-6">
        <div class="panel panel-primary">
          <div class="panel-heading">
            <h3 class="panel-title">内部短消息</h3>
          </div>
          <table class="table table-hover table-condensed">
            <tbody>
            <%-- 遍历最新短消息列表（最多5条） --%>
            <c:forEach items="${recentMsgs}" var="msg">
              <tr>
                <td>&nbsp;<a href="xx/duanxiaoxi/msgInfo?oid=${msg.oid}">${msg.biaoti}</a></td>
              </tr>
            </c:forEach>

            <%-- 不足5条时补充空白行 --%>
            <c:forEach begin="${fn:length(recentMsgs)}" end="4">
              <tr>
                <td>&nbsp;</td>
              </tr>
            </c:forEach>

            <tr>
              <td align="right"><a href="xx/duanxiaoxi/listMsg">更多</a></td> <%-- 链接到收件箱列表 --%>
            </tr>
            </tbody>
          </table>
        </div>
      </div>
  </div>
</div>






<script type="text/javascript">
  $(document).ajaxError(function(event,xhr) {
    if(xhr.status=="403"){//没有权限
      document.location.href = xhr.getResponseHeader("url");
    }else if(xhr.status!="200"){
      //alert("服务器错误!");
      console.log("服务器错误!");
    }
  });
</script>
</body>
</html>
